package com.siwei.mes.entity.experiment;

import cn.dev33.satoken.stp.StpUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;


/**
 * 试验台账图片(ExperimentImage)实体类
 *
 * @author linzi
 * @since 2024-01-01 16:37:33
 */
@Data
@Accessors(chain = true)
@Table(name = "pk_experiment_image")
@ApiModel(value = "ExperimentImage", description = "试验台账图片")
public class ExperimentImage implements Serializable {
    private static final long serialVersionUID = 795541561835307798L;
    /**
     * 主键id
     */
    @Id
    @ApiModelProperty(value = "试验台账图片主键ID", name = "id")
    private Long id;
    /**
     * 试验台账id
     */
    @Column(name = "experiment_id")
    @ApiModelProperty(value = "试验台账id", name = "experimentId")
    private Long experimentId;
    /**
     * 抽样id
     */
    @Column(name = "smoke_id")
    @ApiModelProperty(value = "抽样id", name = "smokeId")
    private Long smokeId;
    /**
     * 图片描述
     */
    @Column(name = "mask")
    @ApiModelProperty(value = "图片描述", name = "mask")
    private String mask;
    /**
     * 图片集合 多个图片用逗号隔开
     */
    @Column(name = "experiment_img")
    @ApiModelProperty(value = "图片集合 多个图片用逗号隔开", name = "experimentImg")
    private String experimentImg;
    /**
     * 创建人
     */
    @Column(name = "creater")
    @ApiModelProperty(value = "创建人", name = "creater")
    private Long creater;
    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间", name = "createTime")
    private Date createTime;

    public ExperimentImage init() {
        this.setCreater(StpUtil.isLogin() ? StpUtil.getLoginIdAsLong() : null).setCreateTime(new Date());
        return this;
    }
}
